cond = dist_cond;

for i=1:size(cond,1),
    cond_row = cond(i,:,:,:);
    
    [m idx] = min(cond_row(:));
    [foo b1 a2 b2] = ind2sub(size(cond_row),idx);
    
    fprintf('%2d -> %2d, when %2d -> %2d (%f)\n',i,b1,a2,b2,m);
end